package com.mfw.springboot.model.vo;

import com.mfw.springboot.model.entity.Evaluation;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 评价视图
 *
 * @author mfw
 * @from <a href="https://gitee.com/hanhuaifei/projects">我的gitee</a>
 * @Date 2024/9/26
 */
@Data
public class EvaluationVO implements Serializable {

    /**
     * id
     */
    private Long id;

    /**
     * 评价内容
     */
    private String content;

    /**
     * 评分(0-10)
     */
    private BigDecimal score;

    /**
     * 教练ID
     */
    private Long coachId;

    /**
     * 学员ID
     */
    private Long studentId;

    /**
     * 关联训练计划ID
     */
    private Long planId;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;


    private static final long serialVersionUID = 1L;

    /**
     * 学员信息
     */
    private UserVO student;

    /**
     * 教练信息
     */
    private UserVO coach;

    /**
     * 训练计划信息
     */
    private TrainingPlanVO trainingPlan;

    /**
     * 封装类转对象
     *
     * @param evaluationVO
     * @return
     */
    public static Evaluation voToObj(EvaluationVO evaluationVO) {
        if (evaluationVO == null) {
            return null;
        }
        Evaluation evaluation = new Evaluation();
        BeanUtils.copyProperties(evaluationVO, evaluation);
        return evaluation;
    }

    /**
     * 对象转封装类
     *
     * @param evaluation
     * @return
     */
    public static EvaluationVO objToVo(Evaluation evaluation) {
        if (evaluation == null) {
            return null;
        }
        EvaluationVO evaluationVO = new EvaluationVO();
        BeanUtils.copyProperties(evaluation, evaluationVO);
        return evaluationVO;
    }
}
